package cn.it.controller;

import java.time.LocalDate;
import java.time.Month;
import java.util.Calendar;

public class test {
    public static void main(String[] args) {
        String date = "2020-11-20~2020-12-30";
        String[] replace = date.split("~");
        String da1 = replace[0];
        String da2 = replace[1];

        LocalDate parse = LocalDate.parse(da1);
        int month = parse.getMonthValue();

        //System.out.println(da1.substring(da1.indexOf("-") + 1, da1.lastIndexOf("-")));

        String replace1 = da1.replace(da1.substring(da1.lastIndexOf("-")), "-01");
        String replace11 = da1.replace(da1.substring(da1.lastIndexOf("-")), "-31");
        System.out.println(replace1.concat("~" + replace11));

        String replace2 = da2.replace(da2.substring(da2.lastIndexOf("-")), "-01");
        String replace22 = da2.replace(da2.substring(da2.lastIndexOf("-")), "-31");

        System.out.println(replace1);
        System.out.println(replace11);
        System.out.println(replace2);
        System.out.println(replace22);


        //System.out.println(date.replace(date.substring(date.lastIndexOf("-")), "-01"));
    }
}
